function show(container, popperInstance) {
    // Make the tooltip visible
    container.setAttribute('data-show', '');

    // Enable the event listeners
    popperInstance.setOptions((options) => ({
        ...options,
        modifiers: [
            ...options.modifiers,
            { name: 'eventListeners', enabled: true },
        ],
    }));

    // Update its position
    popperInstance.update();
}

function hide(container, popperInstance) {
    // Hide the tooltip
    container.removeAttribute('data-show');

    // Disable the event listeners
    popperInstance.setOptions((options) => ({
        ...options,
        modifiers: [
            ...options.modifiers,
            { name: 'eventListeners', enabled: false },
        ],
    }));
}

/**
 * target:目标dom,container: 容器dom,configuration: 功能配置项
 */
function createPopperEvent(target, container,configuration) {
    
    const popperInstance = Popper.createPopper(target, container, configuration || {});
    // 添加事件
    const showEvents = ['mouseenter', 'focus'];
    const hideEvents = ['mouseleave', 'blur'];

    showEvents.forEach((event) => {
        target.addEventListener(event, () => {
            show(container, popperInstance)
        });
    });

    hideEvents.forEach((event) => {
        target.addEventListener(event, () => {
            hide(container, popperInstance)
        });
    });
}